package com.school.hjt.schoolclasscard.db;

import org.greenrobot.greendao.DaoException;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.ToMany;
import org.greenrobot.greendao.annotation.ToOne;
import org.greenrobot.greendao.annotation.Unique;

import java.util.List;

/**
 * Created by xqx on 2017/11/16.
 * 学生
 */
@Entity
public class CardStudent {
    @Id
    private String id;
    @Unique
    private String card_no;//学生卡号
    private String student_name;//学生姓名
    private String student_url;//学生头像
    @ToOne(joinProperty = "id")
    private StudentSign studentSign;//关联签到表
    /** Used to resolve relations */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;
    /** Used for active entity operations. */
    @Generated(hash = 693866750)
    private transient CardStudentDao myDao;
    @Generated(hash = 1559177991)
    public CardStudent(String id, String card_no, String student_name,
            String student_url) {
        this.id = id;
        this.card_no = card_no;
        this.student_name = student_name;
        this.student_url = student_url;
    }
    @Generated(hash = 259268140)
    public CardStudent() {
    }
    public String getId() {
        return this.id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getCard_no() {
        return this.card_no;
    }
    public void setCard_no(String card_no) {
        this.card_no = card_no;
    }
    public String getStudent_name() {
        return this.student_name;
    }
    public void setStudent_name(String student_name) {
        this.student_name = student_name;
    }
    public String getStudent_url() {
        return this.student_url;
    }
    public void setStudent_url(String student_url) {
        this.student_url = student_url;
    }
    @Generated(hash = 1829770755)
    private transient String studentSign__resolvedKey;
    /** To-one relationship, resolved on first access. */
    @Generated(hash = 1864938294)
    public StudentSign getStudentSign() {
        String __key = this.id;
        if (studentSign__resolvedKey == null || studentSign__resolvedKey != __key) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            StudentSignDao targetDao = daoSession.getStudentSignDao();
            StudentSign studentSignNew = targetDao.load(__key);
            synchronized (this) {
                studentSign = studentSignNew;
                studentSign__resolvedKey = __key;
            }
        }
        return studentSign;
    }
    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 1131990310)
    public void setStudentSign(StudentSign studentSign) {
        synchronized (this) {
            this.studentSign = studentSign;
            id = studentSign == null ? null : studentSign.getId();
            studentSign__resolvedKey = id;
        }
    }
    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }
    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }
    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }
    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 1357531708)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getCardStudentDao() : null;
    }
}
